<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>申报记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/templates/act/process-xl.js"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<form class="layui-form searchForm" action="">
    查询:
    <div class="layui-input-inline">
        <input style="width:200px;" type="text" name="declareCode" placeholder="申报编号" autocomplete="off"
               class="layui-input">
    </div>
    <button class="layui-btn" lay-submit lay-filter="formDemo">查询</button>
</form>
<table class="layui-hide" id="dataList" lay-filter="dataList"></table>


<!--<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    {{# if(d.prjPushStatus==0){ }}
    <a class="layui-btn layui-btn-xs" lay-event="change">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    {{# }}}
</script>-->
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    {{# if(d.startTime== null || d.startTime == ''){ }}
    <a class="layui-btn layui-btn-xs" lay-event="change">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    {{# }}}
</script>

<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    var configureCom = {};
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'table', 'matchDict'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var matchDict = layui.matchDict;
        configureCom = layui.configureCom;
        var listData = sessionFun.get(configure.SESSION_PROJECT_LIST_DATA);
        var iframeId = configureCom.GetQueryString('iframeId');//获得当前iframe页面的id
        var cols = [[
            {
                field: 'prjName', title: '申报编号', width: 190, templet: function (d) {
                    return '<p>' + d.declareCode + '</p><p>报审内容:' + matchDict.name(d.submitExamInfo, configure.SUBMIT_EXAM_INFO) + '</p>';
                }
            },
            {
                field: 'kcCorpName', title: '勘察设计单位', width: 190, templet: function (d) {
                    return '<p>勘察单位:' + (d.kcCorpName || '-') + '</p><p>设计单位:' + (d.sjCorpName || '-') + '</p>';
                }
            },
            {
                field: 'createTime', title: '审查机构', templet: function (d) {
                    return '<p>' + (d.checkOrgName || '-') + '</p>'
                }
            },
            {field: 'createTime', title: '申报时间'},
            /*{
                field: 'prjPushStatus', title: '状态', templet: function (d) {
                    return '<p>' + matchDict.name(d.prjPushStatus, configure.SH_STATUS) + '</p>'
                }
            },*/
            {
                field: 'prjPushStatus', title: '状态', templet: function (d) {
                    if(d.startTime == null || d.startTime == ''){
                        return '<p>未报审</p>'
                    }
                    if(d.startTime){
                        return '<p>已报审</p>'
                    }
                    if(d.endTime){
                        return '<p>已完结</p>'
                    }
                }
            },
            {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 170}
        ]];
        configureCom.tableRender(configure.UNIT_PROJECT_APPLY_LIST_HTTP, {prjId: listData.prjId}, cols, 'dataList', 10, '');

        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            sessionFun.set(configure.SESSION_PROJECT_WAIT_LIST_DATA, data);
            if (obj.event === 'detail') {
                editItems('详情', configure.PRJ_DETAIL_READ_HTML);
            } else if (obj.event === 'del') {
                //关闭时重新渲染表格当前页
                top.layer.confirm('确认删除？', {title: '提示'}, function (index) {
                    top.layer.close(index);
                    configureCom.postDataAjax(configure.UNIT_PROJECT_APPLY_DELETE_HTTP, {decId: data.decId}).then(function (res) {
                        if (res.code == 0) {
                            top.layer.msg('删除成功！');
                            configureCom.tableReload(true);
                        } else {
                            top.layer.alert('删除失败！');
                        }
                    });
                });
            } else if (obj.event === 'change') {
                //项目批转
                top.layer.open({
                    type: 2,
                    title: '项目申报',
                    area: configureCom.Psize1,
                    content: configureCom.nocache(configure.UNIT_PROJECT_APPLY_DETAIL_HTML, iframeId),
                    success: function (layero, index) {
                        top.layer.full(index);
                    },
                    end: function () {
                        configureCom.tableReload();
                    }
                });
            }
        });

        //查看详情字典详情
        function editItems(title, url) {
            top.layer.open({
                type: 2,
                title: title,
                area: configureCom.Psize1,
                content: configureCom.nocache(url),
                success: function (layero, index) {
                    top.layer.full(index);
                }
            });
        }

        //监听搜索
        configureCom.tableSearch();
    });
</script>
</body>
</html>